// import ErrorView from '@/components/empty.vue';
import { h } from 'vue'
import {getLatestVerCode} from './app-context';
import { AppError } from '@yanxiu/app-error'
import { errorHandler } from '@/dao/error-code-handlers';
export default function (view) {
    return {
        data() {
            return {};
        },
        async beforeCreate() {
            // getContext.call(this);
            getLatestVerCode.call(this);
        },
        created() {
        },
        computed: {
            pageMessage() {
                return this.$store.state.pageMessage || {};
            }
        },
        methods: {

        },

        render() {
            console.log(11111, this.$route.path);
            console.log(222222, this.pageMessage.code);
            if (this.pageMessage.code) {
                return h( AppError, {
                    data: this.pageMessage,
                    onBtnClick: () => {
                        errorHandler(this.pageMessage);
                    }
                });
            }else {
                return h(view);
            }
            // return h(view);
        }
    }
}